<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
</head>
<body>
<h1>首页</h1>
<form th:action = "@{/testRequestBody}" method = "post">
    用户名：<input type = "text" name = "username"><br/>
    密码： <input type = "password" name = "password"><br/>
    <input type = "submit" value = "测试@RequestBody">
</form>
<form th:action = "@{/testRequestEntity}" method = "post">
    用户名：<input type = "text" name = "username"><br/>
    密码： <input type = "password" name = "password"><br/>
    <input type = "submit" value = "测试@RequestEntity">
</form>
<a th:href = "@{/testResponse}">通过servletAPI的Response对象响应浏览器数据</a><br/>
<a th:href = "@{/testResponseBody}">通过@ResponseBody对象响应浏览器数据</a><br/>
<a th:href = "@{/testResponseUser}">通过@ResponseUser对象响应浏览器User数据</a><br/>



<div id = "app">
    <a @click = "testAxios" th:href = "@{/testAxios}">SpringMVC处理ajax</a>
</div><br/>

<a th:href ="@{/testInterceptor}">测试拦截器</a><br/>


<script type = "text/javascript" th:src = "@{/static/js/vue.js}"></script>
<script type = "text/javascript" th:src = "@{/static/js/axios.min.js}"></script>
<script type = "text/javascript">
    new Vue({
        el:"#app",
        method:{
            testAxios:function(event){
                axios({
                    method:"post",
                    url:event.target.href,
                    params:{
                        username:"admin",
                        password:"123456"
                    }
                }).then(function(repsonse){
                    alert(repsonse.data);
                });
                event.preventDefault();
            }
        }
    })

</script>

</body>
</html>